package com.shopping.service.impl;

import com.shopping.bean.User;
import com.shopping.dao.UserDao;
import com.shopping.service.IUserService;
import com.shopping.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService implements IUserService {
@Autowired
UserDao userDao;
    @Override
    public User getUserByID(Integer id) {
        return userDao.getUserByID(id);
    }

    @Override
    public int editUser(User user) {
        return userDao.editUser(user);
    }

    @Override
    public User getUser(User user) {
        return userDao.getUserByUsername(user.getUsername());
    }

    @Override
    public int add(User user) {
        return userDao.add(user);
    }

    @Override
    public int deleteUser(Integer userid) {
        return userDao.deleteUser(userid);
    }

    @Override
    public List<User> getUserList(String text, Page page) {
        return userDao.getUserList(text, page);
    }

    @Override
    public int getUserCount(String text) {
        return userDao.getUserCount(text);
    }

    @Override
    public int updatePassword(Integer userId, String newPassword) {
        return userDao.updatePassword(userId, newPassword);
    }

}
